package d01007;

//import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

public class Animal {
    //成员变量 成员属性 储存信息
    private String aname;
    private double weight;
    public Animal(){
        System.out.println("无参数构造函数.......");
    }
    public Animal(String aname){
        System.out.println("带一个参数的构造函数......");
        this.aname=aname;
    }
    public Animal(String aname,double weight){
        System.out.println("带所有参数的构造函数......");
        this.aname=aname;
        this.weight=weight;
    }

    //对外提供对应的setter方法用于对属性赋值
    public void setAname(String aname){
        //当形参名与全局变量名称相同，就近原则
        //所有this this指定就是当前对象
        System.out.println(this);
        this.aname=aname;
    }
    public void setWeight(double weight){
        if(weight<0){
            return;
        }
        this.weight=weight;
    }
    //对外提供对应的getter方法用于获取属性值
    public String getAname(){
        return aname;
    }
    public double getWeight(){
        return weight;
    }
    //行为-->成员方法
    public void walking(){
        System.out.println("遛弯.........");
    }
    //获取信息
    public String getInfo(){
        return "名称："+aname+",体重："+weight;
    }
}
